package com.sisy.demo.controller;

import com.sisy.demo.service.UserService;
import com.sisy.demo.utils.BindingUtil;
import com.sisy.demo.vo.S2VJSONResult;
import com.sisy.demo.vo.UserRegisterVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Description: 用户账号相关接口
 * @author: xx
 * @date: 2020-06-05 15:23
 * @version: 0.0.1
 * @Copyright: 2020 www.jztdata.com Inc. All rights reserved.
 * 注意：本内容仅限于杭州金智塔科技有限公司内部传阅，禁止外泄以及用于其他的商业目
 */
@Controller
@ResponseBody
@RequestMapping("/user")
public class UserController {
    @Autowired
    UserService userService;

    /**
     * 用户注册
     *
     * @param vo	注册信息
     * @return com.jztdata.cl.vo.S2VJSONResult
     * @Author xx
     * @Date 2020-06-05 16:15
     * @throws
     */
    @PostMapping("/register")
    S2VJSONResult register(@Validated UserRegisterVO vo,
                           BindingResult result){
        BindingUtil.checkBindingResult(result);
        userService.register(vo);
        return S2VJSONResult.ok();
    }
}
